﻿package chenji.moreitemfunapi;

import java.io.File;
import java.util.logging.Logger;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;

import chenji.moreitemfun.Main;
import chenji.moreitemfunapi.command.CommandMoreItemFun;
import chenji.moreitemfunapi.item.MifItemManager;
import chenji.moreitemfunapi.textures.TexturesManager;
import chenji.moreitemfunapi.textures.UpdateManager;
import chenji.moreitemfunapi.textures.plm.PLMListener;
import chenji.moreitemfunapi.textures.plm.PluginMessageManager;

public final class MifAPI extends JavaPlugin {
	private static Logger logger;
	private static File datafolder;
	private static PluginMessageManager plmm;
	private static UpdateManager textureupdatemanager;
	private static TexturesManager texturesmanager;
	private static MifItemManager im;

	public static Logger getMLogger() {
		return MifAPI.logger;
	}

	public void onEnable() {
		MifAPI.logger = super.getLogger();
		MifAPI.logger.info("MoreItemFunAPI正在启动中");
		datafolder = super.getDataFolder();
		if (!super.getDataFolder().exists()) {
			super.getDataFolder().mkdirs();
		}
		plmm = new PluginMessageManager();
		textureupdatemanager = new UpdateManager();
		texturesmanager = new TexturesManager();
		im = new MifItemManager();
		super.getCommand("mif").setExecutor(new CommandMoreItemFun());
		new PLMListener();
		new Main().onEnable();;
	}

	public void onDisable() {
		Bukkit.getScheduler().cancelTasks(this);
	}

	public static File getMDataFolder() {
		return MifAPI.datafolder;
	}

	public static PluginMessageManager getPluginMessageManager() {
		return MifAPI.plmm;
	}

	public static UpdateManager getTexturesUpdateManager() {
		return MifAPI.textureupdatemanager;
	}

	public static TexturesManager getTexturesManager() {
		return MifAPI.texturesmanager;
	}

	public static MifItemManager getItemManager() {
		return im;
	}

}
